package com.example.myapplicationwork;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class DetailActivity extends AppCompatActivity {

    private TextView titleTextView;
    private TextView descriptionTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);

        titleTextView = findViewById(R.id.detailTitle);
        descriptionTextView = findViewById(R.id.detailDescription);

        // 获取传递过来的数据
        Intent intent = getIntent();
        if (intent != null && intent.hasExtra("item")) {
            ItemModel item = (ItemModel) intent.getSerializableExtra("item");
            if (item != null) {
                // 显示详细信息
                titleTextView.setText(item.getTitle());
                descriptionTextView.setText(item.getDescription());
            }
        }
    }
}